Method and apparatus for compressing digital image data

ABSTRACT

A method for compressing digital image data with greyscale values comprises making at least three predictions of the greyscale value of each pixel and comparing the predicted values with the actual value of the pixel. The difference values between the respective predicted values and the actual value of each pixel is computed, and the median difference value of the three difference values is selected for bit coding. Bit coding is carried out by using variable length bit codes, the shortest length bit code being assigned to the most frequently occurring median difference value. The coded values of the median differences are bit packed, and in the case of a pixel where the absolute median difference value exceeds a predetermined value, the actual pixel value is bit packed.

[0001] The present invention relates to a method and apparatus forcompressing digital image data.

[0002] Images are commonly stored and transmitted in digital form. Wheresuch images include greyscale, the value of the greyscale of each pixelis provided in digital form, typically, in binary code. In images wherea large range of greyscale values are required, for example, in X-rays,it is not unusual to code the greyscale levels in eight bit binarycodes, thus giving 256 levels of greyscale. In general, such images areprovided in raster format which comprise a plurality of horizontal scanlines, each line containing a plurality of individuals pixels, each ofwhich is assigned a greyscale value which specifies the level ofgreyscale corresponding to that point in the image. Typically, the levelof greyscale is defined in each pixel by an eight to twelve bit code.Because of the large number of bits which are used for defining thelevel of greyscale in each pixel, an image stored in raster formatrequires a relatively large storage capacity, and additionally, takes upa lot of bandwidth on communication channels for transmission of theimage. Even in the case of a black and white image with greyscale, thestorage capacity is high. In the case of colour images, where threeprimary colours and the corresponding intensities of the respectivecolours are required to define each pixel of a colour image, the storagecapacity is increased by a factor of three. Various attempts have beenmade to compress such images, however, such attempts to date suffer froma number of disadvantages. Firstly, many compression methods are notlossless, in other words, between compression and decompression, part ofthe digital data making up the image is lost, and an accuratereconstruction of the image after decompression cannot be prepared.While in some applications such losses are acceptable, they are entirelyunacceptable in many cases, typically, in images relating to medicineand diagnostic medicine, for example, X-rays and the like. Imagecompression systems which are essentially lossless suffer from thedisadvantage that the compression ratio is relatively low, and thus inmany cases, little saving on the storage space or the bandwidth occupiedby such images in the transmission thereof is gained. Even wherecompression ratios are reasonable, such image compression systems tendto be relatively complex, complicated and time-consuming, and also mayrequire large storage space to effect the compression. Typical imagecompression systems are described in U.S. Pat. No. 4,809,350, EuropeanPatent Specification No. 0,479,563 and European Patent Specification No.0,536,801. The image compression methods described in these threespecifications suffer from one or more of the disadvantages discussedabove.

[0003] There is therefore a need for a method for compressing digitalimage data which overcomes the problems of known digital image datasystems and which provides lossless or effectively lossless compression,while at the same time providing reasonable compression.

[0004] The present invention is directed towards providing such a methodand apparatus for compressing digital image data.

[0005] The term “region” as used throughout this specification and theclaims means one pixel or a group of adjacent pixels.

[0006] According to the invention, there is provided a method forcompressing digital image data, the method comprising the steps of

[0007] sequentially scanning a plurality of regions of the image dataand determining the actual value of the data in respective regions,

[0008] predicting the value of image data in at least some of theregions based on the determined actual values of some of the alreadyscanned regions which are adjacent the region for which the image datais being predicted,

[0009] comparing the predicted value with the corresponding actual valueof each region for which a prediction is made, and

[0010] computing the value of the difference between the respectivepredicted values and the corresponding actual values, and

[0011] compressing the respective difference values,

[0012] characterised in that

[0013] at least three predictions of data value are made for each regionfor which a prediction is being made, the predicted value which producesthe median difference value of the difference values between therespective three predicted values and the actual value is selected, andthe median difference value is compressed for each region for which aprediction is made, the respective predicted values for each regionbeing based on the actual value or values of a different scanned regionor regions and/or a different combination or combinations of scannedregions to those for which the others of the predictions for that regionare based.

[0014] In one aspect of the invention, the digital image data is scannedregion by region as a matrix array of regions.

[0015] In another aspect of the invention, one of the predictions ofdata value of a region for which a prediction is being made is based onthe data value of the adjacent region in the column in which the regionfor which the prediction is being made lies.

[0016] In another aspect of the invention, one of the predictions ofdata value of a region for which a prediction is being made is based onthe data value of the adjacent region in the row in which the region forwhich the prediction is being made lies.

[0017] Preferably, one of the predictions of data value of a region forwhich a prediction is being made is based on the gradient of data valuesof two regions approaching the region for which the prediction is beingmade. Advantageously, the prediction of the data value takes intoaccount the slope of the gradient.

[0018] In one aspect of the invention, one of the two regions on which aprediction is based lies closer to the region for which the predictionis being made than the other of the said two regions, and the region ofthe said two regions which is closest to the region for which theprediction is being made is weighted.

[0019] In another aspect of the invention, one of the predictions ofdata value of a region for which a prediction is being made is based onthe data values of three regions which are adjacent to the region forwhich the prediction is being made, one of the said regions lying in thesame column, and the other of said regions lying in the same row as theregion for which the prediction is being made, the third region beinglocated between the said other two regions and being used fordetermining the gradient of the data values between the respective saidother two regions and the region for which the prediction is being made.

[0020] Preferably, a prediction of the data value of every region of thedigital image is made.

[0021] In one aspect of the invention, the respective median differencevalues are compressed by encoding the median difference values withrespective variable length codes, unique codes being assigned to therespective median difference values.

[0022] Preferably, the shortest code is assigned to the most frequentlyoccurring median difference value, and the longest code is assigned tothe least frequently occurring median difference value.

[0023] Advantageously, the codes are different for the positive andnegative values of the same absolute median difference values.

[0024] In one aspect of the invention, the codes assigned to the mediandifference values are binary codes.

[0025] Advantageously, the bit length of the longest code for the mediandifference values does not exceed the bit length of the data value ofany region.

[0026] In one aspect of the invention, the actual data of a region isretained instead of the median difference value for that region shouldthe median difference value for that region exceed a predeterminedvalue. Preferably, a first flag means is set to indicate that the datafollowing the flag means is the actual data value of the region.

[0027] In another aspect of the invention, a second flag means is set toindicate a run of actual data values where the median difference valuesof a run of regions exceeds a predetermined value. Preferably, thenumber of actual data values included in the run is associated with thesecond flag means. Advantageously, the second flag means is providedbefore the run of actual data values.

[0028] Ideally, the coded median difference values and the actual datavalues for the respective regions are stored in a predetermined formatfor subsequent retrieval and decompression.

[0029] In general, the most frequently occurring median difference valueis zero.

[0030] In another aspect of the invention, noise is separated from thedigital image data by separating at least the least significant bit fromthe value of the data in the respective regions in which a prediction ofthe data value is to be made, and from the adjacent regions on which thepredictions are to be based prior to the prediction being made, and theseparated least significant bits are stored in association with thecorresponding compressed median difference values of the respectiveregions. Preferably, the data values remaining of the respective regionsfrom which one or more least significant bits have been separated isdivided by 2^(n) where n is equal to the number of least significantbits separated.

[0031] Preferably, at least some of the digital image data is scannedprior to the separation of noise for determining the number of leastsignificant bits to be separated.

[0032] In a further aspect of the invention, the digital image data ismodified prior to computing the predicted data values for reducing thenumerical difference between the data values occurring in the digitalimage data, the digital image data being modified by arranging all thedetermined actual data values occurring in the image data in the form ofa series of actual data values in ascending order of data values,assigning each actual data value occurring in the image a modified datavalue so that the numerical difference between adjacent modified datavalues is less than the numerical difference between the respectiveadjacent actual data values in the series, the modified data valuesforming the data values on which the predictions are based. Preferably,the modified data values are assigned so that the difference betweenmodified data values which correspond to adjacent data values in theseries of data values is unity. Advantageously, the modified data valuesand the actual data values are cross-referenced in a look-up table.Ideally, an inverse look-up table based on the modified and the actualdata values is prepared for use in subsequent reconstruction of theimage.

[0033] Preferably, each look-up table is stored with the storedcompressed median difference values.

[0034] In one aspect of the invention, a histogram of the actual datavalues occurring in the digital image data is formed for preparing eachlook-up table.

[0035] In one aspect of the invention, the data value of each regiondefines a value of greyscale between and including black and white.

[0036] In another aspect of the invention, the data value of each regiondefines a value of intensity of a colour in a colour image.

[0037] Ideally, the compressed data values of the digital image arestored in a predetermined format for retrieval thereof for subsequentdecompression.

[0038] Ideally, each region defines a pixel. In one aspect of theinvention, the digital image is in raster format.

[0039] In another aspect of the invention, the method is carried out onan acquired image after the image has been acquired.

[0040] In a further aspect of the invention, the method is carried outon an acquired image while the image is being acquired “on-the-fly”.

[0041] In a still further aspect of the invention, the method is carriedout on the acquired image with intermediate storage or in parallel withintermediate storage.

[0042] The image in compressed form is suitable for storing and/ortransmission.

[0043] In another aspect of the invention, the method is used forcompressing a three dimensional image, and one of the axes of the threedimensional image is time, the time axis forming a row or column of thematrix, and that row or column forming the row or column as the case maybe in which a region or regions are located which form a basis forpredicting a data value of a region.

[0044] In another aspect of the invention, the method further comprisesthe step of decompressing the compressed digital image data, thedecompression method comprising the steps in reverse order to the orderof the steps of the compression method.

[0045] Additionally, the invention provides a method for compressingdigital image data, the method comprising the steps of

[0046] sequentially scanning a plurality of regions of the image dataand determining the actual value of the data in respective regions,

[0047] predicting the value of image data in at least some of theregions based on the determined actual values of some of the alreadyscanned regions which are adjacent the region for which the image datais being predicted,

[0048] comparing the predicted value with the corresponding actual valueof each region for which a predicted value is made, and

[0049] computing the value of the difference between the respectivepredicted values and the corresponding actual values, and

[0050] compressing the respective difference values,

[0051] characterised in that

[0052] the respective difference values are compressed by encoding thedifference values with respective variable length codes, unique codesbeing assigned to the respective difference values.

[0053] Preferably, the shortest code is assigned to the most frequentlyoccurring difference value, and the longest code is assigned to theleast frequently occurring difference value.

[0054] In general, the most frequently occurring difference value iszero.

[0055] In a further aspect of the invention, the codes are different forthe positive and negative values of the same absolute difference values.

[0056] The codes assigned to the difference values are binary codes.

[0057] Ideally, the bit length of the longest code does not exceed thebit length of the data value of any region.

[0058] In one aspect of the invention, the actual value of a region isretained instead of the difference value for that region should thedifference value for that region exceed a predetermined value.Preferably, a first flag means is set to indicate that the datafollowing the flag means is the actual data value of the region.

[0059] In another aspect of the invention, a second flag means is set toindicate a run of actual data values where the difference values of arun of regions exceeds a predetermined value. Preferably, the number ofactual data values included in the run is associated with the secondflag means. Advantageously, the second flag means is provided before therun of actual determined data values.

[0060] Ideally, the coded difference values and the actual data valuesfor the respective regions are stored in a predetermined format forsubsequent retrieval and decompression.

[0061] Further, the invention provides a method for compressing digitalimage data, the method comprising the steps of

[0062] sequentially scanning a plurality of regions of the image dataand determining the actual value of the data in respective regions,

[0063] predicting the value of image data in at least some of theregions based on the determined actual values of some of the alreadyscanned regions which are adjacent the region for which the image datais being predicted,

[0064] comparing the predicted value with the corresponding actual valueof each region for which a predicted value is made, and

[0065] computing the value of the difference between the respectivepredicted values and the corresponding actual values, and

[0066] compressing the respective difference values,

[0067] characterised in that

[0068] noise is separated from the digital image data by separating atleast the least significant bit from the value of the data in therespective regions in which a prediction of the data value is to be madeand from the adjacent regions on which the predictions are to be basedprior to the prediction being made, and

[0069] the separated least significant bits are stored in associationwith the corresponding compressed difference values of the respectiveregions.

[0070] Preferably, the data values remaining of the respective regionsfrom which one or more least significant bits have been separated isdivided by 2^(n) where n is equal to the number of least significantbits separated.

[0071] Preferably, at least some of the digital image data is scannedprior to the separation of noise for determining the number of leastsignificant bits to be separated.

[0072] Additionally, the invention provides a method for compressingdigital image data, the method comprising the steps of

[0073] sequentially scanning a plurality of regions of the image dataand determining the actual value of the data in respective regions,

[0074] predicting the value of image data in at least some of theregions based on the determined actual values of some of the alreadyscanned regions which are adjacent the region for which the image datais being predicted,

[0075] comparing the predicted value with the corresponding actual valueof each region for which a predicted value is made, and

[0076] computing the value of the difference between the respectivepredicted values and the corresponding actual values, and

[0077] compressing the respective difference values,

[0078] characterised in that

[0079] the digital image data is modified prior to computing thepredicted data values for reducing the numerical differences between thedata values occurring in the digital image data, the digital image databeing modified by arranging all the determined actual data valuesoccurring in the image data in the form of a series of actual datavalues in ascending order of data values, assigning each actual datavalue occurring in the image a modified data value so that the numericaldifference between adjacent modified data values is less than thenumerical difference between the respective adjacent actual data valuesin the series, the modified data values forming the data values on whichthe predictions are based.

[0080] Preferably, the modified data values are assigned so that thedifference between modified data values which correspond to adjacentdata values in the series of data values is unity.

[0081] Preferably, the modified data values and the actual data valuesare cross-referenced in a look-up table. Advantageously, an inverselook-up table based-on the modified and the actual data values isprepared for subsequent reconstruction of the image.

[0082] Ideally, each look-up table is stored with the stored compresseddifference values.

[0083] In one aspect of the invention, a histogram of the actual datavalues occurring in the digital image data is formed for preparing thelook-up tables.

[0084] Further, the invention provides apparatus for compressing digitalimage data, the apparatus comprising

[0085] a means for sequentially scanning a plurality of regions of theimage data and for determining the actual value of the data inrespective regions,

[0086] a means for predicting the value of image data in at least someof the regions based on the determined actual values of some of thealready scanned regions which are adjacent the region for which theimage data is being predicted,

[0087] a means for comparing the predicted value with the correspondingactual value of each region for which a prediction is made, and

[0088] a means for computing the value of the difference between therespective predicted values and the corresponding actual values, and

[0089] a means for compressing the respective difference values,

[0090] characterised in that

[0091] the means for predicting the value of image data comprises ameans for making at least three predictions of data value for eachregion for which a prediction is being made, a selecting means isprovided for selecting the predicted data value which produces themedian difference value of the difference values between the predicteddata values and the actual value, and the means for compressing therespective difference values compresses the median difference values forthe regions for which a prediction is made, the means for making the atleast three predictions makes the respective predictions for each regionbased on the actual value or values of a different scanned region orregions and/or a different combination or combinations of scannedregions to those for which the others of the predictions for that regionare based.

[0092] Additionally, the invention provides apparatus for compressingdigital image data, the apparatus comprising the steps of

[0093] a means for sequentially scanning a plurality of regions of theimage data and for determining the actual value of the data inrespective regions,

[0094] a means for predicting the value of image data in at least someof the regions based on the determined actual values of some of thealready scanned regions which are adjacent the region for which theimage data is being predicted,

[0095] a means for comparing the predicted value with the correspondingactual value of each region for which a prediction is made, and

[0096] a means for computing the value of the difference between therespective predicted values and the corresponding actual values, and

[0097] a means for compressing the respective difference values,

[0098] characterised in that

[0099] the means for compressing the respective difference valuescomprises a means for encoding the difference values with respectivevariable length codes, a unique code being assigned to each value ofdifference value.

[0100] Further, the invention provides apparatus for compressing digitalimage data, the apparatus comprising the steps of

[0101] a means for sequentially scanning a plurality of regions of theimage data and for determining the actual value of the data inrespective regions,

[0102] a means for predicting the value of image data in at least someof the regions based on the determined actual values of some of thealready scanned regions which are adjacent the region for which theimage data is being predicted,

[0103] a means for comparing the predicted value with the correspondingactual value of each region for which a prediction is made, and

[0104] a means for computing the value of the difference between therespective predicted values and the corresponding actual values, and

[0105] a means for compressing the respective difference values,

[0106] characterised in that

[0107] a means for separating noise from the digital image data isprovided, the separating means separating at least the least significantbit from the value of the data in the respective regions in which aprediction of the data value is to be made, and from the adjacentregions on which the predictions are to be based prior to the predictionbeing made, and

[0108] a means for storing the separated least significant bits inassociation with the corresponding difference values of the respectiveregions.

[0109] The invention also provides apparatus for compressing digitalimage data, the apparatus comprising the steps of

[0110] a means for sequentially scanning a plurality of regions of theimage data and for determining the actual value of the data inrespective regions,

[0111] a means for predicting the value of image data in at least someof the regions based on the determined actual values of some of thealready scanned regions which are adjacent the region for which theimage data is being predicted,

[0112] a means for comparing the predicted value with the correspondingactual value of each region for which a prediction is made, and

[0113] a means for computing the value of the difference between therespective predicted values and the corresponding actual values, and

[0114] a means for compressing the respective difference values,

[0115] characterised in that

[0116] a means is provided for modifying the digital image data prior tocomputing the predicted data values for reducing the numericaldifference between the data values occurring in the digital image data,the said means comprising a means for arranging all the determinedactual data values occurring in the image data in the form of a seriesof actual data values in ascending order of data values, and a means forassigning each actual data value occurring in the image a modified datavalue so that the numerical difference between adjacent modified datavalues is less than the numerical difference between the respectiveadjacent actual data values in the series, the modified data valuesforming the data values on which the predictions are based.

[0117] The invention will be more clearly understood from the followingdescription of an embodiment thereof which is given by way of exampleonly, with reference to the accompanying drawings, in which:

[0118]FIG. 1 is a diagrammatic representation of a digital X-ray imageto which a method for compressing digital image data according to theinvention is to be applied,

[0119]FIG. 2 is a flowchart of the method according to the invention forcompressing the digital image data,

[0120]FIG. 3 is a flowchart of a method also according to the inventionfor decompressing the compressed digital image data,

[0121]FIG. 4 is portion of a histogram showing the frequency of theoccurrence of greyscale values in the image of FIG. 1 which has beencontrast stretched,

[0122]FIG. 5(a) is a numerical representation of the histogram of FIG.4,

[0123]FIG. 5(b) is a look-up table for modifying the image from whichthe histogram of FIG. 4 has been prepared so that the differencesbetween greyscale values occurring in the image is unity,

[0124]FIG. 5(c) is an inverse look-up table, which is the inverse of thelook-up table of FIG. 5(b) for use in restoring the image duringdecompression,

[0125]FIG. 6(a) is an enlarged view of a portion of the image of FIG. 1showing greyscale values of some of the pixels,

[0126]FIG. 6(b) shows the value of the least significant noise bitswhich have been separated from the pixels of FIG. 6(a),

[0127]FIG. 6(c) shows the remaining data value of the pixels of FIG.6(a) after the least significant noise bits have been separated from thepixels,

[0128] FIGS. 7(a) to (c) show algorithms according to the method of theinvention for making three predictions of greyscale value of each of thepixels of the image of FIG. 1,

[0129]FIG. 7(d) illustrates diagrammatically how the three methods ofprediction of FIGS. 7(a) to 7(c) are used in determining a mediandifference value for each pixel,

[0130] FIGS. 7(e) and (f) show algorithms and illustratediagrammatically alternative prediction methods also according to theinvention which include five predictions of greyscale value of eachpixel for enabling a median difference value to be selected,

[0131] FIGS. 8(a) to (d) illustrate mathematically how median differencevalues are selected for ten pixels in the digital image of FIG. 1,

[0132]FIG. 9 illustrates a look-up table for encoding median differencevalues,

[0133]FIG. 10 is a distribution graph illustrating the distribution ofthe median difference values of the image of FIG. 1,

[0134]FIG. 11 shows the values of some of the pixels of FIG. 6 after theimage of FIG. 1 has been modified to reduce the differences betweengreyscale values occurring in the image to unity, the value of the noisebits separated from the modified values of the pixels, and the encodedmedian difference values of the pixels,

[0135]FIG. 12 illustrates a bit packed binary string of the pixels ofFIG. 11,

[0136]FIGS. 13 and 14 illustrate a computer programme in pseudo-codeaccording to the invention for compression of the image of FIG. 1, and

[0137]FIG. 15 illustrates a flow diagram of the computer programme ofFIGS. 13 and 14 for compression of the image of FIG. 1.

[0138] Referring to the drawings, a method for compressing digital imagedata, typically, a digital image of an X-ray 1 will now be described.The digital X-ray image is acquired in raster format, see FIG. 1, havinga plurality of rows 4 of regions, which in this case are pixels 5 whichare formed in a matrix of the rows 4 and columns 6. Each pixel 5 definesthe level of greyscale at the location of the image corresponding to thepixel by an eight bit binary code. Although for convenience ofillustration, the image 1 is illustrated in FIG. 1 as having twelve rows4 and sixteen columns 6 of pixels 5, it will be appreciated by thoseskilled in the art that, in general, such an image would have asignificantly larger number of pixels 5 per row and per column. Ingeneral, the number of pixels per row and column can vary from 64 pixelsper row by 64 pixels per column to 5,000 pixels per row by 4,000 pixelsper column. The method according to the invention is suitable fordealing with an image with any number of pixels per row and per column.Additionally, while in the embodiment of the invention described withreference to the drawings, the level of greyscale of each pixel isdefined by an eight bit binary code, it will be appreciated that thelevel of greyscale may be defined by smaller or larger bit codes,indeed, in general, in X-ray imagery the greyscale level per pixel isdefined by ten or twelve bit binary codes. The method according to theinvention may be used for compressing any digital image irrespective ofthe size of the bit code for defining greyscale values.

[0139] The method according to the invention for compressing the digitalimage comprises the following steps which are set out in the flowchartof FIG. 2. In Step 1, the original X-ray image is acquired and scannedfor determining the actual greyscale value of each pixel. Step 2 thenchecks if there are gaps in greyscale values occurring in the acquiredimage. In other words, Step 2 checks if greyscale values are missingfrom the acquired image. If so, Step 2 modifies the acquired image forreducing the numerical differences between greyscale values occurring inthe image to unity. Step 2 is only carried out where there are gaps ingreyscale values occurring in the acquired image. Such gaps in greyscalevalues could have been caused if the image had already been modified,for example, by contrast stretching. In such cases, many values ofgreyscale would be missing from the image, and such gaps in thegreyscale values would prevent subsequent steps of the method beingcarried out effectively, as will be described below.

[0140] Step 3 checks for noise in the acquired image. If noise ispresent, the noise is separated from each pixel, and this is achieved byseparating the least significant bit or bits from the greyscale valuesof the pixels. The separated noise bits are stored uncompressed as willbe described below in association with the compressed data so that theycan be replaced during decompression of the image.

[0141] In Step 4 the greyscale value of each pixel is predicted, theprediction being based on the determined actual greyscale values of itsadjacent pixels as will be described in detail below. In this embodimentof the invention, three predictions of greyscale values are made foreach pixel. The three predicted greyscale values of each pixel are thencompared with the actual value of the pixel and the values of thedifferences between the predicted values and the actual value arecomputed. The median difference value of the three difference values isselected.

[0142] In Step 5 the median difference values for the pixels are codedusing variable length codes as will be described below.

[0143] In Step 6, the coded median difference values for the pixels arepacked, and the separated noise bits, if noise bits were originallyseparated, are also packed associated with the coded median differencevalues for the corresponding pixels.

[0144] In Step 7, further compression of the packed bits may be carriedout using any suitable known lossless data compression method, such asLZW. Such general lossless data compression methods will be well knownto those skilled in the art. The compressed image is then outputted tostorage or transmitted as desired.

[0145]FIG. 3 illustrates a flowchart for decompression of the compressedimage which comprises Steps 9 to 16, which as can be seen areeffectively the reverse of Steps 1 to 8 of the compression flowchart ofFIG. 2. The flowchart of FIG. 3 will be briefly described below.

[0146] For convenience, each of the Steps 1 to 8 will be describedseparately below under separate headings.

[0147] Input Original Image

[0148] As the original digital image of the X-ray is being acquired, itis scanned. Because each pixel defines the level of greyscale which thepixel represents in eight bit binary form, 256 levels of greyscale areavailable, and because the image is an X-ray image, in general, all 256levels of greyscale will be present in the image if the image has notbeen altered, for example, by contrast stretching or the like. On beingscanned, should it be determined that all or substantially all levels ofgreyscale are to be found in the image, Step 2, namely, the modificationof the image for reducing the numerical differences between greyscalevalues to unity is not required, and is omitted. However, where largegaps occur in the greyscale values found in the image, the method ofStep 2 is applied to the image as will now be described.

[0149] Modification of the Image to Reduce Greyscale Gaps

[0150] Referring now to FIGS. 4 and 5, Step 2 for reducing the numericaldifferences between the greyscale values occurring in the image will nowbe described. A histogram of the frequency of greyscale values occurringin the image is constructed. A typical histogram is illustratedgraphically in FIG. 4, however, in practice the method will be carriedout by a computer programme and the histogram will be prepared in theform of FIG. 5(a). As can be seen from FIGS. 4 and 5, none of the pixelsin the image contain a greyscale value of 0. Four of the pixels containa greyscale value of 1. There are no pixels with greyscale values of 2and 3, and there are five pixels of greyscale value of 4. No pixels havea greyscale value of 5 and 6, but ten pixels have a greyscale value of7. None of the pixels have a greyscale value of 8 or 9 and eleven have agreyscale value of 10. For convenience, the entire image will not beconsidered here, however, towards the top end of greyscale values, fourpixels have a greyscale value of 247, none have greyscale values of 248and 249, and three have a greyscale value of 250, while none havegreyscale values of 251 to 254. One pixel has a greyscale value of 255.In FIG. 5(a) the greyscale values are shown above the boxes and thefrequency of occurrence of the greyscale values are shown by the numbersin the boxes. In order to reduce the differences between the greyscalevalues occurring in the image to unity, the look-up table of FIG. 5(b)is prepared. The greyscale value of 1 is assigned the greyscale value of0 for the reduced modified image. The greyscale value of 4 is assignedthe greyscale value of 1 for the reduced modified image, the greyscalevalue of 7 is assigned the value 2 for the reduced modified image, thegreyscale value of 10 is assigned the greyscale value of 3 for thereduced modified image, and so on up to the greyscale value of 247 whichis assigned the value of 92 for the reduced modified image, and so on upto the greyscale value of 255, which is assigned the value of 94 for thereduced modified image. The greyscale values of 4 to 91 are also allused in the reduced modified image. Accordingly, in the reduced modifiedimage to which the remaining steps of the method will be applied, thedifferences between the greyscale values occurring in the image isunity. FIG. 5(c) illustrates an inverse look-up table for reproducingthe original image during decompression as will briefly be describedbelow.

[0151] In preparing of the modified image the greyscale values of thepixels from 0 to 94 are assigned to the pixels of the acquired image inaccordance with the look-up table of FIG. 5(b). The reduced modifiedimage is then subjected to Step 3, as will now be described.

[0152] Noise Separation

[0153] In Step 3, the acquired image, or if the image has been subjectedto Step 2 the reduced modified image is scanned to ascertain the levelof noise. Any suitable method may be used, for example, the number ofnoise planes may be calculated using bit plane entropy statistics, whichwill be known to those skilled in the art. This will determine thenumber of least significant bits to be separated from each pixel toreduce noise to an optimum level. This method will also determine ifthere is insufficient noise to justify separation, and if so, the imageis passed to Step 4. Where noise is present, typically, one to threeleast significant bits will be separated. In this embodiment of theinvention, the two least significant bits are separated from the valueof each pixel and stored. Each pixel is then divided by four, namely,2^(n) where n is the number of least significant bits which have beenseparated, namely, in this case, two. This maintains the differencebetween the greyscale values occurring in the image or the reducedmodified image at unity. The two least significant bits which have beenseparated from each pixel are stored in pixel order for subsequent bitpacking which will be described below. After the step of noisereduction, the digital image is then subjected to Step 4.

[0154] Prediction of Greyscale Value

[0155] Referring now to FIGS. 6 to 8, Step 4, the step of predicting thegreyscale value in each pixel of the image will now be described. Theimage which is subjected to Step 4 may be the acquired image if theimage has not been subjected to modification under Step 2 and noiseseparation under Step 3. Alternatively, the image which is subject toStep 4 may be a modified image which may or may not have been subjectedto noise separation, or the acquired image which may or may not havebeen subjected to noise separation. In this embodiment of the invention,the image has been modified and also subjected to noise separation.

[0156] Referring initially to FIG. FIG. 6(a) illustrates a portion ofthe matrix of pixels 5, and pixel values are shown in some of the pixels5. These are the actual pixel values of the acquired image as it wasacquired. FIG. 6(b) shows the modified values of the pixels from pixelP_([i−1,j−1]) to pixel P_([i,j+9]) after the image had been modifiedunder Step 2. FIG. 6(c) shows pixel values for the same pixels as inFIG. 6(b) after the image has been subjected to Step 3, namely noisereduction. It is the pixel values of FIG. 6(c) which are the actualvalues of the pixels which are used as a basis for making the threepredicted values of the respective pixels.

[0157] For the purpose of describing the method, the greyscale value ofpixel P_([i,j]) will be described. The pixel value of pixel P_([i,j]) ispredicted based on the actual values of the following pixels:

P_([i,j−1]), P_([i−1,j]) and P_([i−1,j−1])

[0158] The three predictions of the value of pixel P_([i,j]) are madeand the differences between each predicted value and the actual value ofthe pixel P_([i,j]) from FIG. 6(c) are computed.

[0159] A first prediction of the value of the pixel P_([i,j]) is madebased on the actual value shown in FIG. 6(c) of the pixel P_([i,j−1])where the first predicted value of P_([i,j]) is

{circumflex over (P)}1_([i,j]) =P _([i,j−1]),

[0160] see FIG. 7(a).

[0161] Since the value of the pixel P_([i,j−1]) is equal to 6, the firstpredicted value

{circumflex over (P)}1_([i,j])=6.

[0162] A second prediction of the value of the pixel P_([i,j]) is basedon the value shown in FIG. 6(c) of the pixel P_([i−1,j]) and isdetermined by the formula

{circumflex over (P)}2_([i,j]) =P _([i−1,j]),

[0163] see FIG. 7(b).

[0164] Since the value of the pixel P_([i−l,j]) is 11, the secondpredicted value

{circumflex over (P)}2_([i,j])=11.

[0165] A third prediction of the value of the pixel P_([i,j]) is madebased on the values shown in FIG. 6(c) of the pixels P_([i,j−1]),P_([i−1,j]) and the gradient of the pixel values in rows i−1 between thepixels P_([i−1,j−1]) and P_([i−1,j]), and the gradient of the pixelvalues in column j−1 between the pixels P_([i−1,j−1]) and P_([i,j−1]).This is obtained from the formula

{circumflex over (P)}3_([i,j]) =P _([i,j−1])+(P _([i−1,j]) −P_([i−1,j−1]))

[0166] see FIG. 7(c), where {circumflex over (P)}3_([i,j]) is the thirdpredicted value.

[0167] The value of the pixel P_([i−1,j−1]) is 8 and since the values ofthe pixels P_([i,j−1]) and P_([i−1,j]) are 6 and 11, respectively, thethird predicted value {circumflex over (P)}3_([i,j]) from the formula ofFIG. 7(c) is 9.

[0168] The three predicted values {circumflex over (P)}1_([i,j]),{circumflex over (P)}2_([i,j]) and {circumflex over (P)}3_([i,j]) andthe actual value of the pixel P_([i,j]) are compared and the respectivedifferences values between the predicted values and the actual value arecomputed. The difference values between the three predicted values andthe actual value of pixel P_([i,j]) are shown in FIGS. 8(a) to (c). Thedifference value between the first predicted value and the actual valueis +4, the difference value between the second predicted value and theactual value is −1, and the difference value between the third predictedvalue and the actual value is +1. In accordance with the method of theinvention, the median difference value is selected, which in this caseis +1, see FIG. 8(d). The median difference value is then coded as willbe described below in accordance with Step 5. Also in FIGS. 8(a), (b)and (c), the difference values between the first, second and thirdpredicted values {circumflex over (P)}1, {circumflex over (P)}2 and{circumflex over (P)}3, and the actual values of the pixels P_([i,j+1])to P_([i,j+1]) are also shown. The median difference values for thepixels P_([i,j+1]) to P_([i,j+1]) are shown in FIG. 8(d). The first,second and third predicted values, {circumflex over (P)}1, {circumflexover (P)}2 and {circumflex over (P)}3, respectively, are determined inthe same manner as described above for determining the first, second andthird predicted values {circumflex over (P)}1_([i,j]), {circumflex over(P)}2_([i,j]) and {circumflex over (P)}3_([i,j]), respectively, and therespective difference values and the median values are likewise computedin similar fashion as the difference values and median difference valuefor the pixel P_([i,j]).

[0169] After each median difference value has been computed, the mediandifference value is encoded in accordance with Step 5 which will now bedescribed.

[0170] Difference Coding

[0171] Referring now to FIGS. 9 and 10, the bit codes which are ofvariable length for coding the median difference values are illustratedin the look-up table of FIG. 9. The median difference value of 0 is themost frequently occurring median difference value, and thus the shortestbit code, namely, the one bit code “0” is assigned to this. The mediandifference values of ±1 are the next most frequently occurring mediandifference values and the next shortest bit codes which are three bitcodes are assigned to these, and so on up to the median differencevalues of ±6, to which eight bit codes are assigned. FIG. 10 illustratesthe distribution of the median difference values for the X-ray image ofFIG. 1. Each code of FIG. 9 is a unique code, and when read from theright-hand side to the left-hand side can be instantly identified asbeing a bit code for coding the median difference values, thesignificance of this is that there is no need to indicate the beginningand end of the bit codes for the median difference values when the bitcodes are being bit packed as will be described below in relation toStep 6.

[0172] As discussed above, the bit codes for the difference values −6and +6 are eight bit codes. Since the value of each pixel is provided inan eight bit code, there is no advantage in coding difference valuesover −6 or +6, since the bit code would be longer than the actual bitcode of the pixel. In such cases, where the median difference valueexceeds +6 or −6, the actual value of the pixel is stored and bitpacked, see Step 6 below. A first flag means is provided for flaggingwhen an actual value of a pixel is being bit packed, and in this case,the first flag means is an eight bit code which is shown in the look-uptable of FIG. 9 against the abbreviation “Lit 1”. The actual valuereferred to here is the value of the pixel after modification of theimage under Step 2 and noise reduction under Step 3. Where a run ofpixels is encountered where the median difference values in each caseexceeds ±6, the actual values of the pixels in the run are bit packed. Asecond flag means for indicating that a run of actual values of pixelsis being bit packed is provided by an eight bit code which is shown inthe look-up table of FIG. 9 against the abbreviation “Lit N”. After theeight bit code of the second flag the number of pixels in the run isprovided in a four bit code, and then the eight bit values of therespective pixels in the run are bit packed, as will be described below.After the median difference value of each pixel has been coded or itsactual value retained, the coded value or actual value is bit packed ina bit string in accordance with Step 6 which will now be described.

[0173] Bit Packing

[0174] The bit packing of the coded median difference values, the actualvalues of the pixels where appropriate and the separated leastsignificant noise bits will now be described with reference to FIGS. 11and 12. FIG. 11 illustrates the median difference values for the stringof pixels P_([i,j]) to P_([i,j+9]). The median difference values ofthree of the pixels exceeded ±6, and thus the actual values of thosepixels are retained. FIG. 11 also shows the actual modified values ofthe pixels P_([i,j]) to P_([i,j+9]), as well as the values of the noisecomponents, namely, the values of the two least significant noise bitsseparated from the pixels P_([i,j]) to P_([i,j+9]). FIG. 12 shows thebits of pixels P_([i,j]) to P_([i,j+9]) bit packed into a string ofbits. The median difference value of pixel P_([i,j]) is +1, and thedifference value code from the look-up table of FIG. 9 is 101. The noisebits which had been separated from the pixel value are combined with thedifference value code and included in the string. In this case, thenoise bits which had been separated under Step 3 are the bits 01. Forconvenience and for ease of understanding FIG. 12, the least significantbits which have been included along with the median difference valuecodes and actual values are underlined. The bits for each pixel of FIG.12 are combined and illustrated in boxes. The value of the mediandifference value code or the actual value of the pixel which is bitpacked for each of the pixels is shown above the relevant box. Themedian difference value of pixel P_([i,j+1]) is also +1, and thus themedian difference value code is 101. The separated noise bits of 10 arecombined with the median difference value code 101. In the case of pixelP_([i,j+2]) the median difference value is −2, and thus the mediandifference value code is 1100. The two least significant noise bits 11which had been separated from pixel P_([i,j+2]) are combined with themedian difference value code. The median difference values of pixelsP_([i,j+3]) and P_([i,j+4]) being greater than ±6, the actual values of26 and 34, respectively, of these two pixels are included in the bitstring. However, to indicate that the actual values of the two pixelsP_([i,j+3]) and P[i,j+4] are being included in the bit string, thesecond flag “Lit 2” is included in the bit string preceding the actualvalues of these two pixels, and the second flag “Lit 21” is followed bythe four bit code indicating that the next two values following thesecond flag “Lit 2” are actual values. Since no noise bits wereseparated from the pixel P_([i,j+3]), the two bits 00 are combined withthe actual value of the pixel P_([i,j+3]). The noise bits which wereseparated from the pixel P_([i,j+4]) of 01 are combined with the actualvalue of the pixel in the bit string. The median difference value codeis bit packed for the pixels P_([i,j+6]) and P_([i,j+7]). Since themedian difference value of the pixel P_([i,j+8]) exceeds ±6, the actualvalue is bit packed along with the noise bits which had been separated.In the case of the pixel P_([i,j+9]) the median difference value code isbit packed along with the noise bits which had been separated.

[0175] After bit packing, the compression of the image according to theinvention has been completed. The compressed bit packed image may thenbe subjected to further well-known compression techniques, for example,LZW compression if desired. The bit packed image or the compressed bitpacked image is then outputted along with relevant header informationwhich is required for decompression, and the compressed bit packed imageand the header information may be stored or transmitted. The headerinformation contains details of the image width, the height and thenumber of bits per pixel, in other words, the number of bits used forgiving the greyscale value of each pixel in the originally acquiredimage. The header information also includes an indication as to whetheror not the image was modified to reduce the gaps between the greyscalevalues occurring in the original image, and if so, the headerinformation also includes the inverse look-up table. The headerinformation includes the number of least significant bits which wereseparated in the compression method for optimising noise reduction. Theheader information also includes the algorithms used for predicting thelevels of greyscale of each pixel.

[0176] Turning now to FIG. 3, the steps of decompression will briefly bedescribed. Under Step 9, the compressed image from Step 8 is acquired.Step 10 decompresses the bit packed image if the bit packed image hadbeen subjected to LZW compression or other well-known compression, usingthe appropriate decompression algorithm. Step 10 is omitted if the imageacquired by Step 9 had not been subjected to Step 7. Step 11 thenunpacks the bits and separates the least significant bits from the codedmedian difference values or the actual values of the pixels as the casemay be. The image from Step 11 is then subjected to Step 12 which usingsimilar algorithms to those described with reference to Step 4 predictsthe values of the pixels and determines the median difference values. InStep 13, the median difference values are then decoded using the tableof FIG. 9 in reverse, and the image is subjected to Step 14 whichreturns the noise to the pixel values determined from Step 13. If theimage was subjected to reduction modification of Step 2, the image issubjected to Step 15 which by the use of the inverse look-up table ofFIG. 5(c) reverses Step 2 of the compression method, and then Step 16outputs a restored image which is identical to the original imageacquired in Step 1.

[0177] Returning now to FIGS. 7(e) and 7(f) two alternative predictionmethods for predicting the value of pixel P_([i,j]) are illustrated. Ineach of these prediction methods, two further additional predictions ofthe pixel values of pixel P_([i,j]) are carried out as well as the firstthree predictions, {circumflex over (P)}1_([i,j]), {circumflex over(P)}2_([i,j]) and {circumflex over (P)}3_([i,j]) already described. Inthe case of the method of FIG. 7(e), a fourth prediction {circumflexover (P)}4_([i,j]) of the pixel value of pixel P_([i,j]) is carried outbased on the previous two pixels in the row i, namely, pixel P_([i,j−1])and pixel P_([i,j−2]) from the formula

{circumflex over (P)}4_([i,j])=2×P _([i,j−1]) −P _([i,j−2])

[0178] Since the pixel P_([i,j−1]) is closer to the pixel P_([i,j]) thanis the pixel P_([i,j−2]), this latter pixel P_([i,j−2]) is weighted witha weighting of 2. Pixel P_([i,j−2]) gives the gradient of the pixelvalues between the pixel P[i,j−2] and the pixel P_([ij−1]) The fifthprediction {circumflex over (P)}5_([i,j]) is carried out based on thetwo adjacent pixels in the column j, namely, pixels P_([i−1,j]) andpixel P_([i−2,j]) in similar fashion from the formula

{circumflex over (P)}5_([i,j])=2×P _([i−1,j]) −P _([i−2,j])

[0179] The pixel P_([i−1,j]) being closest to the pixel P_([i,j]) isgiven a weighting of 2, while the pixel P_([i−2,j]) gives the gradient.

[0180] In this embodiment of the invention, the difference valuesbetween the five predicted values, {circumflex over (P)}1_([i,j]),{circumflex over (P)}2_([i,j]), {circumflex over (P)}3_([i,j]),{circumflex over (P)}4_([i,j]) and {circumflex over (P)}5_([i,j]) andthe actual value of the pixel P_([i,j]) are computed and the mediandifference value of the five difference values is selected.

[0181] In the case of FIG. 7(f), the fourth and fifth predictions whichfor convenience are referred to as {circumflex over (P)}6_([i,j]) and{circumflex over (P)}7_([i,j]) are based on pixels which are diagonallyaligned with the pixel P_([i,j]) from the formulae

{circumflex over (P)}6_([i,j])=2×P _([i−1,j−1]) −P _([i−2,j−2]),

[0182] and

{circumflex over (P)}7[i,j]=2×P _([i−1,j+1]) −P _([i−2,j+2]).

[0183] The closest pixels to the pixel P_([i,j]) of the diagonallyaligned pixels, namely, pixels P_([i−1,j−1]) and P_([i−1,j+1]) arerespectively weighted with a value of 2. The pixels P_([i−2,j−2]) andP_([i−2,j+2]) give the gradient of the pixel values between the pixelsP_([i−2,j−2]) and P_([i−1,j−1]), and P_([i−2,j+2]) and P_([i−1,j+1]),respectively. In this case, the difference values between the fivepredicted values {circumflex over (P)}1_([i,j]), {circumflex over(P)}2_([i,j]), {circumflex over (P)}3_([i,j]), {circumflex over(P)}6_([i,j]) and {circumflex over (P)}7_([i,j]) and the actual value ofthe pixel P_([i,j]) are computed and the median difference value of thefive difference values is selected.

[0184] By using five predictions as opposed to three, the mediandifference values, in general, will be closer to zero.

[0185] The method according to the invention may be implemented inhardware or software, typically, it will be implemented in software on acomputer, however, it may be implemented in an integrated circuit chip.A typical computer programme in pseudo-code is set out in FIGS. 13 and14, and a flow diagram of the computer programme is illustrated in FIG.15. The computer programme will now be briefly described, however, itwill be readily apparent to those skilled in the art that many othersuitable programmes for implementing the method may be used withoutdeparting from the scope of the invention. The computer programme ofFIGS. 13 and 14 makes two passes over the digital image. The first passwill be described with reference to FIG. 13, and the second pass will bedescribed with reference to FIG. 14. The first pass comprises threefunctions. The first function is to prepare the greyscale valuesfrequency array from the digital image. The second function is tocalculate the greyscale value reduction and restoration look-up tables,in other words, the forward look-up table of FIG. 5(b) for preparing areduced modified digital image and the inverse look-up table of FIG.5(c) for restoring the modified reduced image to its original form afterdecompression. The third function determines the number of leastsignificant bits to be separated from the greyscale value of each pixelfor optimising noise reduction.

[0186] Line 1 of the programme clears the grey level frequency arrays.Lines 2 and 3 on scanning of the image prepares the frequency array ofFIG. 5(a) by incrementing the greyscale value frequency count of eachgreyscale value as a pixel of that greyscale value is located in theimage. Lines 4 and 5 create the forward looking look-up table of FIG.5(b) and the inverse look-up table of FIG. 5(c). Lines 6, 7, 8 and 9calculate for each bit plane starting with the least significant bitplane the entropy statistic and the run statistic. If either testindicates noise then the function breaks and increments the noise planeNR by one. Determination of the number of least significant bits to beseparated using bit plane entropy statistics will be well known to thoseskilled in the art.

[0187] The second pass of the computer programme will now be describedwith reference to FIG. 14. Pass 2 comprises two programme functions. Thefirst function outputs image header information for use indecompression, and the second function compresses the data in accordancewith the method. Lines 1, 2 and 3 of the first function of the secondpass forms the image header which includes the image width, height andbits per pixel. The header also includes the number of least significantbits separated for optimising noise reduction and the inverse look-uptable for restoring the greyscale level of the compressed image to formthe original image after decompression. This header information as wellas other header information discussed above is outputted with thecompressed image. The second programme function which compresses theimage commences with Line 4 which calls Function 1 of the first pass toprepare the greyscale frequency array of FIG. 5(a). Line 5 of the secondprogramme function of the second pass calls the second function of thefirst pass for calculating the forward look-up table and the inverselook-up table of FIGS. 5(b) and (c). Line 6 of the second programmefunction of the second pass calls the third function of the first pass,namely, the function which calculates the number of least significantbits to be separated. Line 7 of the second pass calls the output imageheader information. The second pass then moves on to Line 8, and foreach pixel in the image, Line 8 applies the greyscale level reductionlook-up table of FIG. 5(b) for preparing a modified image with numericaldifferences between the greyscale values occurring in the image reducedto unity. Line 9 of the second pass separates the appropriate number ofleast significant bits from the bit value of each pixel and then dividesthe remaining bit value of the pixel by 2^(n) where n equals the numberof least significant bits separated for noise reduction. Line 10 of thesecond pass makes the relevant number of predictions of the value ofeach pixel and Line 11 compares the predicted values with the actualvalue of the pixel and computes the difference values between therespective predicted values and the actual value. Line 11 also selectsthe median difference value from the difference values of each pixel.Line 12 checks if the absolute median difference value is less than orequal to 6, and if so, Line 13 selects the appropriate variable lengthbit code corresponding to the median difference value from the look-uptable of FIG. 9 and outputs the appropriate variable length bit code forthe pixel. If it is determined that the absolute value of the mediandifference value is greater than 6 then Line 14 selects the appropriatecode, namely, “Lit 1” or “Lit N” which is outputted and Line 15 outputsthe actual pixel value after the relevant bit code “Lit 1” or “Lit N”.Should a run of pixels occur where the actual value is to be outputted,the number of actual values in the run is outputted after the code for“Lit N” in a four bit code as already described. Line 16 outputs theseparated least significant bits along with either the variable lengthbit code of each pixel or the actual value of each pixel as appropriate.

[0188] Turning now to FIG. 15 the flow diagram of the computer programmewill now be briefly described. The digital image data is received andthe predictor type is selected. This will normally be selected by theoperator. In other words, the operator will select whether threepredictions of pixel value are to be made for each pixel, five andpossibly seven, and the operation will also determine the algorithms formaking each prediction. The acquired digital image data is passed toblock 1 which identifies the bit planes containing noise and determinesthe number of least significant bits to be separated, if any. Thedigital image data is also passed through block 2 which prepares thegreyscale frequency array of the type illustrated in FIG. 5(a). Thehistogram of frequencies is then passed to block 3 which prepares thelook-up table of the type of FIG. 5(b). The histogram of frequencies isalso passed to block 4 which prepares the inverse look-up table of thetype illustrated in FIG. 5(c) for restoring the image. The digital imagedata is also passed to block 5 which reduces the greyscale values of theimage using an appropriate look-up table of the type of FIG. 5(b). Themodified image resulting from block 5 is passed to block 6 where thenumber of least significant bits determined by block 1 are separatedfrom the modified image. The modified image with the least significantbits having been separated is then passed to block 7 which prepares therelevant number of predictions of greyscale value for each pixel basedon the selected number of predictions to be made, and compares thepredicted values with the actual greyscale value of the pixel of themodified image and computes the difference values between the respectivepredicted values and the actual value. Block 7 then selects the mediandifference value of the difference values. Block 8 checks if theabsolute value of the median difference value for each pixel is lessthan or equal to 6. If less than or equal to 6, the difference value iscoded using the variable length codes of FIG. 9 by block 9. Should block8 determine that the absolute value of the median difference value isgreater than 6, the appropriate bit code “Lit 1” indicating an actualvalue is outputted by block 10 and the actual value of the pixel issubsequently outputted by block 11 to form a bit stream of the type ofthat of FIG. 12. The image may then be stored or transmitted orsubjected to further known compression and then stored or transmitted.

[0189] The advantages of the invention are many. By virtue of the factthat a number of predictions of the greyscale value of each pixel aremade, any noise which may occur in individual predicted values isseparated by virtue of the fact that the median difference value basedon the predictions is selected. By virtue of the fact that the code usedfor encoding the median difference values is a variable length bit code,efficient compression of data is achieved and by assigning the shortestcodes to the median difference values most frequently occurring, furthersignificant reduction of the compressed image is achieved.

[0190] Where the acquired image has already been modified by contraststretching, reducing the numerical differences between the greyscalevalues occurring in the image to unity considerably improves thecompression process. Since most naturally occurring images, typically,X-ray images, generally do not have sudden jumps in greyscale valuesbetween adjacent pixels, and thus if the differences between thegreyscale values occurring in the image is unity, in general, thedifference in greyscale values between adjacent pixels should berelatively low and commonly in the order of 0 to 6. This, thus, ensuresthat the median difference values between the predicted and actualvalues of pixels will be relatively small, and in most cases, below ±1,see the distribution of difference values of FIG. 10. This furtherenhances the reduction which can be achieved during compression.Separation of noise from the bit values of each pixel prior tocompression further adds to the efficiency of compression, since it hasbeen found that the compression of noise gives no benefit. The use ofmedian values of the difference values achieves two important advantagesin one step. Firstly, it combines the results of several matchedpredictions, and these matched predictions are selected to work well incombination and each one is selected to respond to particular featuresin the image data. Secondly, noise in a pixel on which an individualprediction is made is reduced by ignoring values of spuriouspredictions. This is important since the most effective predictions arebased on a small matrix of immediate neighbouring values of pixels, andsuch predictions may be subject to considerable noise. This matrix ofneighbourhood pixels which is available for predicting the value of thepixel P_([i,j]) can clearly be seen in FIG. 6. It will be apparent tothose skilled in the art that only previous values of the current rowand previous rows are available for prediction if the compression anddecompression is performed in a scan line order.

[0191] In general, it has been found that the method according to theinvention provides relatively high compression ratios typically of theorder of 4:1, with no loss of image data.

[0192] It will be appreciated by those skilled in the art that since thefirst pixel in the first row and in the first column, in other words,pixel P_([1,1]) will be the first pixel to be scanned, it will not bepossible to make a prediction for this pixel, and thus, the actual valueof the first pixel will be bit packed in the bit stream in theappropriate manner as already described. Similarly, since it is notpossible to base predictions for the pixels in the first row on pixelsin a previously occurring row, a lesser number of predictions will bemade for the pixels P_([1,2]) onwards in the first row. In cases wherethree predictions are being made as described with reference to FIGS.7(a), (b), (c) and (d), in general, only the prediction of FIG. 7(a),namely, prediction {circumflex over (P)}1 will be made for the pixels inthe pixels from P_([1,2]) onwards for the first row. The differencevalues computed between the predicted values and the actual values ofthe relevant pixels will then be encoded. The header information storedand transmitted with the bit packed image will include the algorithm oralgorithms used for making the predictions of the predicted values ofthe pixels in the first row of the image. It will be appreciated thatwhere five predictions are being made of the greyscale value for eachpixel using the predictions of FIGS. 7(e) or (f), it will not bepossible to make five predictions for the pixels in the first two rows,and accordingly, these first two rows of the image will be treated asjust described.

[0193] It will be appreciated that while the compression method has beendescribed as comprising the eight steps of FIG. 2, as already discussedwhere an acquired image has not been altered with resultant gaps ingreyscale values, Step 2 may be omitted. Similarly, in certain cases,Step 3 may be omitted. Firstly, Step 3 may be omitted if there is littlenoise in the acquired image, and even where there is noise in theacquired image, in certain cases, Step 3 may be omitted. Steps 4, 5 and6 of FIG. 2 are essential to the invention, however, it will beappreciated that any odd number of predictions of pixel values may bemade once there are at least three predictions in order to provide amedian difference value. It will also be appreciated that while specificbit codes have been described for coding the median difference values,other suitable bit codes may be provided, although, as discussed above,it is important that the bit codes should be of the shortest lengthpossible, and preferably, of variable length, the codes of shortestlengths being assigned to the most frequently occurring mediandifference values. While bit packing is essential to the invention,other suitable bit packing methods may be used.

[0194] As discussed above, it will be appreciated that the number ofbits defining the greyscale value of each pixel is irrelevant to themethod of the present invention. The method for compressing digitalimage data according to the invention may be used irrespective of thenumber of bits defining the greyscale values of the pixels. Indeed, itwill be appreciated that the higher the number of bits which define thegreyscale values of the pixels, the more efficient will be thecompression. Furthermore, where more than eight bits are used fordefining greyscale values, for example, ten to twelve bits, it isenvisaged that where noise does occur, more than the two leastsignificant bits may be separated from the value of each pixel ifnecessary, in certain cases, it is envisaged that up to four, andpossibly, five least significant bits may be separated from the pixelvalue.

[0195] It will also be appreciated that the order in which the steps ofthe method according to the invention is carried out may be altered. Forexample, noise separation may be carried out on the acquired image priorto modification of the image to reduce the numerical differences betweenthe greyscale values occurring in the image.

[0196] While the method has been described for use in compressing adigital X-ray image in black and white with greyscale, it will beappreciated that the method may also be used for compressing a digitalcolour image where the pixels define the intensities of the respectiveprimary colours. In such cases, the image would comprise a set of threeimages, one for each of the three primary colours, and the image foreach colour may be compressed separately, or, alternatively, the imagesmay be compressed simultaneously, where either the rows or columns ofpixels would correspond to a row or column of pixels extending fromcolour image to colour image.

[0197] The invention is not limited to the embodiment hereinbeforedescribed which may be varied in construction and detail.

1. A method for compressing digital image data, the method comprisingthe steps of sequentially scanning a plurality of regions of the imagedata and determining the actual values of the data in respectiveregions, making at least three predictions of the value of image datafor each of at least some of the regions based on the determined actualvalues of some of the already scanned regions which are adjacent theregion for which the image data is being predicted, comparing each ofthe three predicted values with the actual values of the correspondingregions for which predictions are made, computing the values of thedifferences between the respective predicted values and the actual valuefor each region for which a prediction is made, selecting the mediandifference value for each region for which a prediction is made, andcompressing the respective median difference values, characterised inthat a first one of the at least three predictions of data values ofeach region for which a prediction is made is based on the actual datavalue of a first region adjacent the region for which the prediction isbeing made, the first region lying in a row in which the region forwhich the prediction is being made lies, a second one of the at leastthree predictions of data values of each region for which a predictionis made is based on the actual data value of a second region adjacentthe region for which the prediction is being made, the second regionlying in a column in which the region for which the prediction is beingmade lies, and a third one of the at least three predictions of datavalues of each region for which a prediction is made is based on thegradients of actual data values from a third region to the first regionand from the third region to the second region, the third region beinglocated adjacent the first and second regions and adjacent the regionfor which the prediction is being made and lying in the row in which thefirst region lies, and lying in the column in which the second regionlies.
 2. A method as claimed in claim 1 characterised in that thedigital image data is scanned region by region as a matrix array ofregions.
 3. A method as claimed in claim 1 or 2 characterised in thateach third prediction of the data value takes into account the slopes ofthe gradients.
 4. A method as claimed in any preceding claimcharacterised in that at least some of the at least three predictions ofdata values of each region for which a prediction is made are based onthe actual data values of at least two regions, one of which lies closerto the region for which the prediction is being made than the others ofthe said at least two regions, the actual values of the said at leasttwo regions being weighted in proportion to their closeness to theregion for which a prediction is being made.
 5. A method as claimed inany preceding claim characterised in that the at least three predictionsof data values are made for every region of the digital image.
 6. Amethod as claimed in any preceding claim characterised in that therespective median difference values are compressed by encoding themedian difference values with respective variable length codes, uniquecodes being assigned to the respective median difference values.
 7. Amethod as claimed in claim 6 characterised in that the shortest code isassigned to the most frequently occurring median difference value, andthe longest code is assigned to the least frequently occurring mediandifference value.
 8. A method as claimed in claim 6 or 7 characterisedin that the codes are different for the positive and negative values ofthe same absolute median difference values.
 9. A method as claimed inany of claims 6 to 8 characterised in that the codes assigned to themedian difference values are binary codes.
 10. A method as claimed inany of claims 6 to 9 characterised in that the bit length of the longestcode for the median difference values does not exceed the bit length ofthe data value of any region.
 11. A method as claimed in any of claims 6to 10 characterised in that the actual data value of a region isretained instead of the median difference value for that region shouldthe median difference value for that region exceed a predeterminedvalue.
 12. A method as claimed in claim 11 characterised in that a firstflag means is set to indicate that the data following the flag means isthe actual data value of the region.
 13. A method as claimed in claim 11or 12 characterised in that a second flag means is set to indicate a runof actual data values where the median difference values of a run ofregions exceeds a predetermined value.
 14. A method as claimed in claim13 characterised in that the number of actual data values included inthe run is associated with the second flag means.
 15. A method asclaimed in claim 13 or 14 characterised in that the second flag means isprovided before the run of actual data values.
 16. A method as claimedin any of claims 6 to 15 characterised in that the coded mediandifference values and the actual data values for the respective regionsare stored in a predetermined format for subsequent retrieval anddecompression.
 17. A method as claimed in any preceding claimcharacterised in that the most frequently occurring median differencevalue is zero.
 18. A method as claimed in any preceding claimcharacterised in that noise is separated from the digital image data byseparating at least the least significant bit from the value of the datain the respective regions in which a prediction of the data value is tobe made, and from the regions on which the predictions are to be basedprior to the prediction being made, and the separated least significantbits are stored in association with the corresponding compressed mediandifference values of the respective regions.
 19. A method as claimed inclaim 18 characterised in that the data values remaining of therespective regions from which one or more least significant bits havebeen separated is divided by 2^(n) where n is equal to the number ofleast significant bits separated.
 20. A method as claimed in claim 18 or19 characterised in that at least some of the digital image data isscanned prior to the separation of noise for determining the number ofleast significant bits to be separated.
 21. A method as claimed in anypreceding claim characterised in that the digital image data is modifiedprior to computing the predicted data values for reducing the numericaldifference between the data values occurring in the digital image data,the digital image data being modified by arranging all the determinedactual data values occurring in the image data in the form of a seriesof actual data values in ascending order of data values, assigning eachactual data value occurring in the image a modified data value so thatthe numerical difference between adjacent modified data values is lessthan the numerical difference between the respective adjacent actualdata values in the series, the modified data values forming the datavalues on which the predictions are based.
 22. A method as claimed inclaim 21 characterised in that the modified data values are assigned sothat the difference between modified data values which correspond toadjacent data values in the series of data values is unity.
 23. A methodas claimed in claim 21 or 22 characterised in that the modified datavalues and the actual data values are cross-referenced in a look-uptable.
 24. A method as claimed in claim 23 characterised in that aninverse look-up table based on the modified and the actual data valuesis prepared for use in subsequent reconstruction of the image.
 25. Amethod as claimed in claim 23 or 24 characterised in that each look-uptable is stored with the stored compressed median difference values. 26.A method as claimed in any of claims 23 to 25 characterised in that ahistogram of the actual data values occurring in the digital image datais formed for preparing each look-up table.
 27. A method as claimed inany preceding claim characterised in that the data value of each regiondefines a value of greyscale between and including black and white. 28.A method as claimed in any preceding claim characterised in that thedata value of each region defines a value of intensity of a colour in acolour image.
 29. A method as claimed in any preceding claimcharacterised in that the compressed data values of the digital imageare stored in a predetermined format for retrieval thereof forsubsequent decompression.
 30. A method as claimed in any preceding claimcharacterised in that each region defines a pixel.
 31. A method asclaimed in any preceding claim characterised in that the digital imageis in raster format.
 32. A method as claimed in any preceding claimcharacterised in that the method is carried out on an acquired imageafter the image has been acquired.
 33. A method as claimed in anypreceding claim characterised in that the method is carried out on anacquired image while the image is being acquired “onthe-fly”.
 34. Amethod as claimed in any preceding claim characterised in that themethod is carried out on the acquired image with intermediate storage orin parallel with intermediate storage.
 35. A method as claimed in anypreceding claim characterised in that the image in compressed form issuitable for storing and/or transmission.
 36. A method as claimed in anypreceding claim characterised in that the method is used for compressinga three dimensional image, and one of the axes of the three dimensionalimage is time, the time axis forming a row or column of the matrix, andthat row or column forming the row or column as the case may be in whicha region or regions are located which form a basis for predicting a datavalue of a region.
 37. A method as claimed in any preceding claimcharacterised in that the method further comprises the step ofdecompressing the compressed digital image data, the decompressionmethod comprising the steps in reverse order to the order of the stepsof the compression method.
 38. A method for compressing digital imagedata, the method comprising the steps of sequentially scanning aplurality of regions of the image data and determining the actual valueof the data in respective regions, predicting the value of image data inat least some of the regions based on the determined actual values ofsome of the already scanned regions which are adjacent the region forwhich the image data is being predicted, comparing the predicted valuewith the corresponding actual value of each region for which a predictedvalue is made, and computing the value of the difference between therespective predicted values and the corresponding actual values, andcompressing the respective difference values, characterised in that thedigital image data is modified prior to computing the predicted datavalues for reducing the numerical differences between the data valuesoccurring in the digital image data, the digital image data beingmodified by arranging all the determined actual data values occurring inthe image data in the form of a series of actual data values inascending order of data values, assigning each actual data valueoccurring in the image a modified data value so that the numericaldifference between adjacent modified data values is less than thenumerical difference between the respective adjacent actual data valuesin the series, the modified data values forming the data values on whichthe predictions are based.
 39. A method as claimed in claim 38characterised in that the modified data values are assigned so that thedifference between modified data values which correspond to adjacentdata values in the series of data values is unity.
 40. A method asclaimed in claim 38 or 39 characterised in that the modified data valuesand the actual data values are cross-referenced in a look-up table. 41.A method as claimed in claim 40 characterised in that an inverse look-uptable based on the modified and the actual data values is prepared forsubsequent reconstruction of the image.
 42. A method as claimed in claim40 or 41 characterised in that each look-up table is stored with thestored compressed difference values.
 43. A method as claimed in any ofclaims 40 to 42 characterised in that a histogram of the actual datavalues occurring in the digital image data is formed for preparing thelook-up tables.
 44. A method for compressing digital image data, themethod comprising the steps of sequentially scanning a plurality ofregions of the image data and determining the actual value of the datain respective regions, predicting the value of image data in at leastsome of the regions based on the determined actual values of some of thealready scanned regions which are adjacent the region for which theimage data is being predicted, comparing the predicted value with thecorresponding actual value of each region for which a predicted value ismade, and computing the value of the difference between the respectivepredicted values and the corresponding actual values, and compressingthe respective difference values, characterised in that the respectivedifference values are compressed by encoding the difference values withrespective variable length codes, unique codes being assigned to therespective difference values.
 45. A method for compressing digital imagedata, the method comprising the steps of sequentially scanning aplurality of regions of the image data and determining the actual valueof the data in respective regions, predicting the value of image data inat least some of the regions based on the determined actual values ofsome of the already scanned regions which are adjacent the region forwhich the image data is being predicted, comparing the predicted valuewith the corresponding actual value of each region for which a predictedvalue is made, and computing the value of the difference between therespective predicted values and the corresponding actual values, andcompressing the respective difference values, characterised in thatnoise is separated from the digital image data by separating at leastthe least significant bit from the value of the data in the respectiveregions in which a prediction of the data value is to be made and fromthe adjacent regions on which the predictions are to be based prior tothe prediction being made, and the separated least significant bits arestored in association with the corresponding compressed differencevalues of the respective regions.
 46. Apparatus for compressing digitalimage data, the apparatus comprising a means for sequentially scanning aplurality of regions of the image data and for determining the actualvalues of the data in respective regions, a means for making at leastthree predictions of the value of image data in each of at least some ofthe regions based on the determined actual values of some of the alreadyscanned regions which are adjacent the region for which the image datais being predicted, a means for comparing each of the at least threepredicted values with the actual values of the corresponding regions forwhich predictions are made, and a means for computing the values of thedifferences between the respective predicted values and the actual valuefor each region for which a prediction is made, a means for selectingthe median difference value for each region for which a prediction ismade, and a means for compressing the respective median differencevalues, characterised in that the means for making the at least threepredictions comprises a means for making a first one of the at leastthree predictions of data values which is based on the actual data valueof a first region adjacent the region for which the prediction is beingmade, the first region lying in a row in which the region for which theprediction is being made lies, a means for making a second one of the atleast three predictions of data values which is based on the actual datavalue of a second region adjacent the region for which the prediction isbeing made, the second region lying in a column in which the region forwhich the prediction is being made lies, and a means for making a thirdone of the at least three predictions of data values which is based onthe gradients of actual data values from a third region to the firstregion and from the third region to the second region, the third regionbeing located adjacent the first and second regions and adjacent theregion for which the prediction is being made and lying in the row inwhich the first region lies, and lying in the column in which the secondregion lies.
 47. Apparatus for compressing digital image data, theapparatus comprising the steps of a means for sequentially scanning aplurality of regions of the image data and for determining the actualvalue of the data in respective regions, a means for predicting thevalue of image data in at least some of the regions based on thedetermined actual values of some of the already scanned regions whichare adjacent the region for which the image data is being predicted, ameans for comparing the predicted value with the corresponding actualvalue of each region for which a prediction is made, and a means forcomputing the value of the difference between the respective predictedvalues and the corresponding actual values, and a means for compressingthe respective difference values, characterised in that a means isprovided for modifying the digital image data prior to computing thepredicted data values for reducing the numerical difference between thedata values occurring in the digital image data, the said meanscomprising a means for arranging all the determined actual data valuesoccurring in the image data in the form of a series of actual datavalues in ascending order of data values, and a means for assigning eachactual data value occurring in the image a modified data value so thatthe numerical difference between adjacent modified data values is lessthan the numerical difference between the respective adjacent actualdata values in the series, the modified data values forming the datavalues on which the predictions are based.
 48. Apparatus for compressingdigital image data, the apparatus comprising the steps of a means forsequentially scanning a plurality of regions of the image data and fordetermining the actual value of the data in respective regions, a meansfor predicting the value of image data in at least some of the regionsbased on the determined actual values of some of the already scannedregions which are adjacent the region for which the image data is beingpredicted, a means for comparing the predicted value with thecorresponding actual value of each region for which a prediction ismade, and a means for computing the value of the difference between therespective predicted values and the corresponding actual values, and ameans for compressing the respective difference values, characterised inthat the means for compressing the respective difference valuescomprises a means for encoding the difference values with respectivevariable length codes, a unique code being assigned to each value ofdifference value.
 49. Apparatus for compressing digital image data, theapparatus comprising the steps of a means for sequentially scanning aplurality of regions of the image data and for determining the actualvalue of the data in respective regions, a means for predicting thevalue of image data in at least some of the regions based on thedetermined actual values of some of the already scanned regions whichare adjacent the region for which the image data is being predicted, ameans for comparing the predicted value with the corresponding actualvalue of each region for which a prediction is made, and a means forcomputing the value of the difference between the respective predictedvalues and the corresponding actual values, and a means for compressingthe respective difference values, characterised in that a means forseparating noise from the digital image data is provided, the separatingmeans separating at least the least significant bit from the value ofthe data in the respective regions in which a prediction of the datavalue is to be made, and from the adjacent regions on which thepredictions are to be based prior to the prediction being made, and ameans for storing the separated least significant bits in associationwith the corresponding difference values of the respective regions.